package adapters;

import java.util.List;

import Persistance.TMain;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.mypokerstats.R;

public class MainAdapter extends BaseAdapter {

	public List<TMain> mains;
	private LayoutInflater inflater;
	private ViewHolderTournoi holder;
	
	public MainAdapter(Context context, List<TMain> liste) {
		this.inflater = LayoutInflater.from(context);
		this.mains = liste;
	}
	
	@Override
	public int getCount() {
		return mains.size();
	}

	@Override
	public Object getItem(int arg0) {
		return mains.get(arg0);
	}

	@Override
	public long getItemId(int position) {
		return mains.get(position).getNum ();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		holder = new ViewHolderTournoi();
		convertView = inflater.inflate(R.layout.drawer_list_item, null);
		holder.tvLibelle = (TextView) convertView.findViewById(R.id.tvLibelle);
		holder.tvLibelle.setText(mains.get(position).getNum());
		convertView.setTag(position);

		return convertView;
	}
	
	private class ViewHolderTournoi {
		TextView tvLibelle;
	}
	

}
